package com.imooc.security.core.social.view;

import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.stereotype.Component;
import org.springframework.web.servlet.view.AbstractView;

/**
 * 绑定成功返回的视图
 * @Author: JZH
 * @Date: 2018/11/4 19:47
 * @Description: 由于需要多个服务商共同使用，因此bean的注册写在每个服务商的config中
 */
@Component("connect/callback.doConnected")
public class ImmocConnectResponseView extends AbstractView {
    @Override
    protected void renderMergedOutputModel(Map<String, Object> model, HttpServletRequest request, HttpServletResponse response) throws Exception {
        response.setContentType("text/html;charset=utf-8");
        String html = "<h3>";
        if(null == model.get("connection")) {
            html += "解绑成功";
        } else {
            html += "绑定成功";
        }
        html += "</h3>";
        response.getWriter().write(html);
    }
}
